<?php

/**
 * Create a new folder.
 * 
 * @author Volker Kueffel <volker.kueffel@gmail.com>
 * @version $Id: store_folder.php 35 2009-02-12 22:25:46Z volker.kueffel $
 */

require_once('config.php');
require_once('LDAPConnector.class.php');
require_once('Utils.class.php');

$ldap=LDAPConnector::init($config);

$result=new StdClass();
$result->success=false;

if ($ldap) {
	if (array_key_exists('subdn',$_REQUEST) && $_REQUEST['subdn'] && array_key_exists('name',$_REQUEST) && $_REQUEST['name']) {
		$dn=$ldap->getFullDN($_REQUEST['subdn']);
		$result->success=$ldap->addFolder($dn,$_REQUEST['name']);
		$result->parentId=md5(Utils::getParentDN($dn));
	}
}
echo json_encode($result);
?>